﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MbUnit.Framework;

namespace Frost.Tests.FolderTestRepositorySpecs {

    [TestFixture]
    public class when_test_repository_retrieves_tests : with_folder_test_repository {
        protected IEnumerable<ITest> Tests { get; set; }

        protected override void BecauseOf() {
            Tests = _folderRepository.GetTests();
        }
        [Test]
        public void should_search_for_html_extensions() {
            _folderRepository.ValidFileExtensions.ShouldContain(".html");
        }

        [Test]
        public void should_search_for_htm_extensions() {
            _folderRepository.ValidFileExtensions.ShouldContain(".htm");
        }

        [Test]
        public void should_grab_all_html_and_htm_files() {
            Tests.Count().ShouldBe(2);
        }
        
        [Test]
        public void should_contain_FitTest1_html() {
            Tests.ShouldContain(x => x.Name == "FitTest1.html");
        }

        [Test]
        public void should_contain_FitTest2_htm() {
            Tests.ShouldContain(x => x.Name == "FitTest2.htm");
        }
    }
    public abstract class with_folder_test_repository {
        protected FolderTestRepository _folderRepository;
        protected abstract void BecauseOf();

        [SetUp]
        public void Setup() {
            _folderRepository = new FolderTestRepository(TestConfiguration.Default.FitTestFolder);

            BecauseOf();
        }
    }
}
